package com.huosu.commons.response;

import lombok.Getter;

/**
 * API 状态码
 *
 * @author lyc
 */
@Getter
public enum ApiErrorCode {

    //-------------系统-----------------
    SUCCESS(200, "成功"),

    FAIL(-200, "请求异常，请联系管理员"),

    NO_OAUTH2(401, "无权限访问"),

    NO_FOUND(404, "请求找不到"),

    BAD_REQUEST(400, "参数错误"),

    SYS_ERROR(500, "系统错误"),

    //-------------权限-----------------
    NULL_TOKEN(999, "请求头未携带token"),

    TOKEN_FAIL(1000, "token认证失败"),

    LOGIN_FAIL(1001, "登录失败，用户名或密码错误"),

    LOGIN_PASS_ERROR(1002, "登录失败，用户名或密码错误"),

    NULL_USERNAME(1003, "登录失败，用户名为空"),

    NULL_PASSWORD(1004, "登录失败，密码为空"),

    //-------------表单-----------------
    USERNAME_ALREADY_EXISTS(666, "用户名已存在"),

    PHONE_ALREADY_EXISTS(667, "手机号已存在"),

    USE_DELETE_ERROR(668, "不能删除当前登录用户"),

    USE_MANAGER_DELETE_ERROR(669, "不能删除初始管理员用户"),

    //-------------自定义-----------------
    IP_ERROR(600, "IP解析错误"),

    IP_COMPARE_ERROR(630, "IP解析错误,前者IP要小于后者IP"),

    IP3_ERROR(620, "IP解析错误，非内网IP"),

    MINER_CONFIGURATION_FILE(700, "矿机配置文件上传解析错误"),

    NOT_THE_SAME_IP_SEGMENT(601, "IP不在同一IP段内"),


    //-------------挖矿地址和矿工名-----------------
    NET_ERROR(605, "网络连接异常"),

    POOL_ERROR_1(6021, "挖矿地址1解析错误"),

    POOL_ERROR_2(6022, "挖矿地址2解析错误"),

    POOL_ERROR_3(6023, "挖矿地址3解析错误"),

    POOL_MINER_ERROR_2(6032, "挖矿地址2与矿工名2必须同时存在"),

    POOL_MINER_ERROR_3(6033, "挖矿地址3与矿工名3必须同时存在"),

    POOL_MINER_1_ERROR(606, "挖矿地址1和矿工名1不能为空"),

    EXCEL_MINER_ERROR_1(6071, "矿工名1错误"),

    EXCEL_MINER_ERROR_2(6072, "矿工名2错误"),

    EXCEL_MINER_ERROR_3(6073, "矿工名3错误"),

    EXCEL_POOL_CHECK_ERROR_1(6081, "挖矿地址1连接失败，请确认后重试"),

    EXCEL_POOL_CHECK_ERROR_2(6082, "挖矿地址2连接失败，请确认后重试"),

    EXCEL_POOL_CHECK_ERROR_3(6083, "挖矿地址3连接失败，请确认后重试"),

    EXCEL_POOL_RETURN_ERROR_1(6091, "挖矿地址1响应异常，请稍后重试"),

    EXCEL_POOL_RETURN_ERROR_2(6092, "挖矿地址2响应异常，请稍后重试"),

    EXCEL_POOL_RETURN_ERROR_3(6093, "挖矿地址3响应异常，请稍后重试"),

    MINER_ACCOUNT_NULL(6600, "暂无矿机管理用户，请完善【矿机管理】中用户数据"),

    UPGRADE_ING(9001, "请勿重复操作，系统正常升级中"),

    UPGRADE_ING_TIME_OUT(9009, "升级超时，系统即将重启...");

    private Integer code;
    private String msg;

    ApiErrorCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
